<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改订单')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-orderInfo-edit" th:object="${dcOrderInfo}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户名：</label>
            <div class="col-sm-8">
                <input name="userName" th:field="*{userName}" readonly class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">总价：</label>
            <div class="col-sm-8">
                <input name="totalPrice" readonly th:field="*{totalPrice}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">取餐时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input name="takeTime" th:value="${#dates.format(dcOrderInfo.takeTime, 'yyyy-MM-dd')}"
                           class="form-control" placeholder="yyyy-MM-dd" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('order_type')}" readonly>
                    <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}"
                           th:field="*{status}">
                    <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
    </form>
</div>

<div class="btn-group-sm" id="toolbar" role="group">
    订单详情
</div>
<div class="col-sm-12 select-table table-striped">
    <table id="bootstrap-table"></table>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
    var prefix = ctx + "dc/orderInfo";
    $("#form-orderInfo-edit").validate({
        focusCleanup: true
    });

    var prefix1 = ctx + "dc/orderDetail";
    $(function () {
        var idStr = $("#id").val();
        var options = {
            url: prefix1 + "/listByOederId",
            createUrl: prefix1 + "/add",
            updateUrl: prefix1 + "/edit/{id}",
            removeUrl: prefix1 + "/remove",
            exportUrl: prefix1 + "/export",
            showSearch: false,
            showPageGo: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            modalName: "订单详情",
            queryParams: {
                orderId: idStr
            },
            columns: [{
                checkbox: true
            },
                {
                    field: 'carId',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'foodId',
                    title: '美食'
                },
                {
                    field: 'foodName',
                    title: '名称'
                },
                {
                    field: 'foodNumber',
                    title: '数量'
                },
                {
                    field: 'orderId',
                    title: '订单'
                }
            ]
        };
        $.table.init(options);
    });


    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-orderInfo-edit').serialize());
        }
    }

    $("input[name='takeTime']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>